function GMRP.BuyItem( ply, command, args )

	for itemname, item in pairs(GMRP.Items) do
	
		if tostring( args[1] ) == itemname then
		
			if GMRP.UseLimit( ply ) then

				if ( item.Type != "blackmarket" ) then
				
					local pTN = ply:getJob()
				
					if  !table.HasValue( Jobs[pTN][5] , item.Type ) then
					
						ply:RedNotify( pTN.." can not buy "..string.lower( item.Name ).."." )
						return
						
					end
					
				end
				
				if ply:HasMoney( tonumber( item.Price ) ) then 
				
					ply:TakeMoney( item.Price )
					ply:GreenNotify( item.Name.." has been purchased and put in your inventory." )
					GMRP.AddToInentory( ply, itemname )
					
				else
				
					ply:RedNotify("You do not have enough money!")
					
				end
				
			end	
		end
	end
	
end	

GMRP.command( "buyitem", GMRP.BuyItem )
